/**
 * @author caesar
 * @date 2025/6/30
 * @apiNote
 */
/*for循环方法一
从1循环到150并在每行打印一个值，另外在每个3的倍数行上打印出“foo”,在每个5的倍数行上打印“biz”,在每个7的倍数行上打印输出“baz”
public class practice4_3 {
    public static void main(String[] args) {
        for (int i = 1; i <= 150; i++) {
            System.out.print(i);//只打印i的值
            if (i % 3 == 0) {
                System.out.print(" foo ");
            }
            if (i % 5 == 0) {
                System.out.print(" biz ");
            }
            if (i % 7 == 0) {
                System.out.print(" baz ");
            }
            System.out.println();//只打印换行
        }
    }
}
*/

//转换成字符串，直接拼接也可以
/*for循环方法二
public class practice4_3 {
    public static void main(String[] args) {

        for (int i = 1; i <= 150; i++) {
            String str = i + "";
            str += i % 3 == 0 ? " foo " : "";
            str += i % 5 == 0 ? " biz " : "";
            str += i % 7 == 0 ? " baz " : "";
            System.out.println(str);
        }

    }
}
*///while循环
    /*
public class practice4_3 {
    public static void main(String[] args) {
        int i = 1;
        while(i<=150){
            String str = i + "";
            str += i % 3 == 0 ? " foo " : "";
            str += i % 5 == 0 ? " biz " : "";
            str += i % 7 == 0 ? " baz " : "";
            System.out.println(str);
            i++;
        }
    }
}
*/
    //do while循环
public class practice4_3 {
    public static void main(String[] args) {
        int i = 1;
        do{
            String str = i + "";
            str += i % 3 == 0 ? " foo " : "";
            str += i % 5 == 0 ? " biz " : "";
            str += i % 7 == 0 ? " baz " : "";
            System.out.println(str);
            i++;
        }while(i<=150);
    }
}